import Vue from 'vue'
import VueRouter from 'vue-router'
import About from '../components/About'
import Home from '../components/Home'
import Message from '../components/Message'
import News from '../components/News'
import MessageDetail from '../components/MessageDetail';

Vue.use(VueRouter)
export default new VueRouter({
  routes: [{
    path: '/about',
    component: About
  }, {
    path: '/home',
    component: Home,
    children: [ //子路由
      {
        path: '/home/news',
        component: News
      },{
        path: 'message',  //简写 /home 下子路由
        component: Message,
        children:[
          {
            path: 'detail/:id', // params 方式; query方式带？
            component:MessageDetail
          }
        ]
      },{
        path: '', //当前路由
        redirect: '/home/news'
      }
    ]
  }, {
    path: '/', //跟路由
    redirect: '/home', //设置默认路由
  }]
})
